package lampsServer;

import java.awt.Component;
import java.awt.Font;

import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

@SuppressWarnings("rawtypes")
//服务器路灯列表单元格设计
class MyCellRenderer extends JLabel implements ListCellRenderer{
	private static final long serialVersionUID = 1L;
	public MyCellRenderer() {
		//单元格不透明
		this.setOpaque(true);
		//单元格中字体设置
		this.setFont(new Font("微软雅黑", Font.BOLD, 16));
	}
	@Override
	public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
			boolean cellHasFocus) {
		if(value!=null){
			setText("路灯" + value.toString());		
		}
		if(isSelected){
			setBackground(list.getSelectionBackground());
			setForeground(list.getSelectionForeground());
		}else{
			setBackground(list.getBackground());
			setForeground(list.getForeground());
		}
		return this;
	}	
}
